package com.spring.boot.quartz.config;

import org.cleaver.spring.application.ApplicationContextUtil;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Map;

/**
 * spring-boot项目启动后执行程序
 *
 * @author LiKun
 * @date 2021/7/31 0:38
 */
@Component
public class ApplicationInitialize implements ApplicationRunner {
    @Resource(name = "jobInit")
    private Map<String, QuartzJobBean> jobInit;
    @Resource
    private ApplicationContextUtil applicationContextUtil;

    /**
     * 服务启动后执行的接口
     *
     * @param args SpringApplication.run()传递的参数
     *
     * @throws Exception 相关异常
     */
    @Override
    public void run(ApplicationArguments args) throws Exception {
//        jobInit.putAll(applicationContextUtil.getRealizeBeans(QuartzJobBean.class));
    }
}
